/*
 * @author: 谢小龙
 * @Date: 2021-05-11 14:41:16
 * @LastEditTime: 2021-05-11 16:11:36
 * @description: 处理按键拦截
 */
class InterceptF11 {
  /**
   * @lastUpdateBy : 张瀚
   * @description: 开始拦截F11，避免全屏展示功能无法用代码退出全屏
   */
  startIntercept() {
    document.addEventListener("keydown", this._keyControlFunction);
  }

  /**
   * @author: 谢小龙
   * @description: 键盘监听函数
   * @param {*} event
   */
  _keyControlFunction(event) {
    if (event.key == "F11") {
      event.preventDefault();
    }
  }

  /**
   * @author: 谢小龙
   * @description: 移除监听事件
   */
  destroy() {
    document.removeEventListener("keydown", this._keyControlFunction);
  }
}
